<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" th:href="@{/statics/css/common.css}" type="text/css">
</head>
<body>
    <h2 th:text="${news.title}">标题</h2>
    <span th:text="${news.author}">作者</span>
    <span th:text="${news.createTime}">创作时间</span>
    <p th:text="${news.content}">内容</p>
    <ul th:each="comment : ${news.comments}">
        <li>
            <span th:text="${comment.name}"></span>
            <span th:text="${comment.createTime}"></span>
            <p th:text="${comment.content}"></p>
            <span th:if="${session.user != null}"><button th:if="${session.user.id } == ${comment.uid}" href="#">删除</button></span>
        </li>
    </ul>
    <form th:action="@{'/addComment/'+${news.id}}" method="post">
        <span th:if="${session.user != null}">
            <input type="hidden" name="uid" th:value="${session.user.id}">
        </span>
        <textarea name="content" placeholder="请输入评论"></textarea><br>
        <input type="submit" value="提交">
    </form>
<script th:src="@{/statics/js/jquery-3.6.0.js}"></script>
<script>
</script>
</body>
</html>